<template>
    <template v-if="menu.children === null">
        <menu-item :menu="menu">{{menu.title}}</menu-item>
    </template>
    <template v-else>
        <el-sub-menu :index="menu.code">
            <template #title>
                <i class="el-icon-location"></i>
                <span>{{menu.title}}</span>
            </template>
            <template v-for="child in menu.children" :key="child.id">
                <sub-menu :menu="child"></sub-menu>
            </template>
        </el-sub-menu>
    </template>

</template>

<script>
    import MenuItem from "./MenuItem.vue";
    export default {
        name: "SubMenu",
        props: {
            menu: {
                type: Object
            }
        },
        components: { MenuItem },
        data() {
            return {};
        }
    };
</script>

<style scoped>

</style>
